package com.xianda.selenium;

import java.io.IOException;
import java.net.MalformedURLException;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.phantomjs.PhantomJSDriver;

import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;

public class PhantomJSDriverMain {

	/**
	 * @Title: main
	 * @Description: 通过QQ号码查询用户最新动态 ,只针对没设权限空间,设了权限此方法无用
	 * @param @param
	 *            args
	 * @return void
	 * @throws IOException
	 * @throws MalformedURLException
	 * @throws FailingHttpStatusCodeException
	 * @throws @date
	 *             2016年9月27日下午5:30:46
	 */
	public static void main(String[] args) throws Exception {

		System.setProperty("phantomjs.binary.path", "tools/phantomjs.exe");
		WebDriver driver = new PhantomJSDriver();
		driver.get("http://www.baidu.com");
		System.out.println("page title is:" + driver.getPageSource());
		WebElement element = driver.findElement(By.name("wd"));
		element.sendKeys("滴滴打人");
		element.submit();
		System.out.println("page title is:" + driver.getPageSource());

	}
}
